package com.yc.mvc.bean;

import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;

@Data
public class User {

    @NotEmpty(message = "姓名不能为空！")
    @Length(min=2, max=20,message = "姓名长度必须是2~2个字符")
    String name;
    @NotEmpty
    @Length(min=6,max=16)
            @Pattern(regexp = "[0-9a-zA-Z]+", message = "密码必须是字母加数字组合")
    String pwd;
    @Min(10)
    @Max(80)
    int age;
    @Email(message = "邮箱不正确")
    String email;
    @Pattern(regexp = "1\\d{10}",message = "手机号码格式不正确")
    String phone;
}
